﻿namespace ClearLines.Bumblebee.Tests

open ClearLines.Bumblebee
open System
open NUnit.Framework
open FsUnit

[<TestFixture>]
type SolutionMessageTests() =

   [<Test>]
   member test.``message Solution should be set when constructed``() =
      // Arrange
      let solution = "Solution"
      let quality = 42.0

      // Act
      let message = new SolutionMessage<string>({ Definition = solution; Quality = quality })

      // Assert
      message.Solution |> should equal solution

   [<Test>]
   member test.``message Quality should be set when constructed``() =
      // Arrange
      let solution = "Solution"
      let quality = 42.0

      // Act
      let message = new SolutionMessage<string>({ Definition = solution; Quality = quality })

      // Assert
      message.Quality |> should equal quality

   [<Test>]
   member test.``message DateTime should be set when constructed``() =
      // Arrange
      let solution = "Solution"
      let quality = 42.0

      // Act
      let now = DateTime.Now
      let message = new SolutionMessage<string>({ Definition = solution; Quality = quality })

      // Assert
      let tolerance = new TimeSpan(1000000L) // 0.1 secs (10,000 ticks in a millisecond)
      message.DateTime |> should (equalWithin tolerance) now
